<?php
/**
 * 商品
 *
 * by abc.com 多用户商城
 *
 *
 */
//by abc.com
//use Shopnc\Tpl;

defined('InShopNC') or exit('Access Invalid!');
class goodsControl extends mobileHomeControl{

	public function __construct() {
        parent::__construct();
    }
    
    public function webshareOp() {
        $inc_file = BASE_PATH.DS.'api'.DS.'share'.DS.'jssdk.php';
        require($inc_file);
        $jssdk = new JSSDK("yourAppID", "yourAppSecret");
        $signPackage = $jssdk->GetSignPackage();
        output_data(array('sign'=>$signPackage));
    }
    
    
    /**
     * 区域列表
     */
    public function district_listOp() {
       $district_model=Model('district');
       $district_list=$district_model->getDistrictList(); 
       if (empty($district_list)){
           output_data(array('status'=>"error",'msg'=>"数据为空"));
       }     
        output_data(array('status'=>'success','district_list'=>$district_list));
    }
    
    /**
     * 根据城市获得对应的运费
     */
    public function get_freightOp(){
        //三个参数，area_id,area_parent_id,transport_id
        if($_REQUEST['transport_id'] == 0 && $_REQUEST['goods_freight'] !=0){
            //使用固定运费,但是也要对应的运费模板的固定运费
            output_data(array('goods_freight' => $_REQUEST['goods_freight']));
        }
        
        //需要两个数据，一个area_parent_id，一个transport_id
        $condition['top_area_id']=array('like', '%,' . $_REQUEST['area_parent_id'] . ',%');
        $condition['transport_id']=$_REQUEST['transport_id'];
        
        $model_transport= Model('transport');
        
        $transport = $model_transport->getExtendInfo($condition);

        if (empty($transport)){
            //为空，则为默认模板运费
            $condition1['is_default']=1;
            $condition1['transport_id']=$_POST['transport_id'];
            $transport = $model_transport->getExtendInfo($condition1);
        }
        $goods_freight=$transport[0]['sprice'];

        output_data(array('goods_freight' => $goods_freight));
    } 

    /**
     * 商品列表
     */
    public function goods_listOp() {
        $model_goods = Model('goods');
        $model_search = Model('search');
        $this->page = 0;
        //查询条件
        $condition = array();
        if(!empty($_GET['gc_id']) && intval($_GET['gc_id']) > 0) {
            $condition['gc_id'] = $_GET['gc_id'];
        } elseif (!empty($_GET['keyword'])) {
            $condition['goods_name|goods_jingle'] = array('like', '%' . $_GET['keyword'] . '%');
        }  elseif (!empty($_GET['areaid_1'])) {
            $condition['areaid_1'] = array('eq', $_GET['areaid_1']);
        } elseif (!empty($_GET['areaid_2'])) {
            $condition['areaid_2'] = array('eq', $_GET['areaid_2']);
        }  elseif (!empty($_GET['dist_id'])) {//区域
            if($_GET['dist_id']==5){
                $condition['dist_id'] = 0;
           }else{
               $condition['dist_id'] = array('eq', $_GET['dist_id']);
           }
                   
        }elseif (!empty($_REQUEST['goods_commend'])) {
            $condition['goods_commend'] = array('eq', $_REQUEST['goods_commend']);
        }
        
        if($_REQUEST['had_type']==2){
           $condition['goods_commend'] = $_REQUEST['had_major_id'];
        }elseif ($_REQUEST['had_type']==3){
            $condition['is_discount'] = $_REQUEST['had_major_id'];
        }elseif ($_REQUEST['had_type']==4){
            $condition['goods_flag'] = $_REQUEST['had_major_id'];
        }elseif ($_REQUEST['had_type']==5){
            $condition['goods_id'] = $_REQUEST['had_major_id'];
        }elseif ($_REQUEST['had_type']==1){
            $condition['gc_id'] = $_REQUEST['had_major_id'];
        }
        
        if(!empty($_GET['keyword'])){
            $model_mb_user_token = Model('mb_user_token');
            $key=$_REQUEST['key'];
            $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
            $model_member = Model('member');
            $member_info = $model_member->getMemberInfoByID($mb_user_token_info['member_id']);
            $data['key_word']=$_GET['keyword'];
            $data['key_mobile']=$member_info['member_mobile'];
            $data['key_name']=$member_info['member_name'];
            $data['key_ip']=$_SERVER["REMOTE_ADDR"];
            $data['key_time']=TIMESTAMP;
            $data['client']=$_REQUEST['client'];
            $model_key=Model('key');
            $result=$model_key->saveKey($data);
        }
        
        

        //所需字段
        $fieldstr = "goods_id,goods_commonid,store_id,goods_name,goods_price,goods_marketprice,goods_image,goods_salenum,evaluation_good_star,evaluation_count";
        // 添加3个状态字段
        $fieldstr .= ',is_virtual,is_presell,is_fcode,have_gift';
        //排序方式
        $order = $this->_goods_list_order($_GET['orderkey'], $_GET['order']);
        //优先从全文索引库里查找
        list($indexer_ids,$indexer_count) = $model_search->indexerSearch($_GET,$this->page);
        if (is_array($indexer_ids)) {
            //商品主键搜索
            $goods_list = $model_goods->getGoodsOnlineList(array('goods_id'=>array('in',$indexer_ids)), $fieldstr, 0, $order, $this->page, null, false);
            //如果有商品下架等情况，则删除下架商品的搜索索引信息
            if (count($goods_list) != count($indexer_ids)) {
                $model_search->delInvalidGoods($goods_list, $indexer_ids);
            }
            pagecmd('setEachNum',$this->page);
            pagecmd('setTotalNum',$indexer_count);
        } else {
            $goods_list = $model_goods->getGoodsListByColorDistinct($condition, $fieldstr, $order, $this->page);
        }
        $page_count = $model_goods->gettotalpage();

        //处理商品列表(抢购、限时折扣、商品图片)
        $goods_list = $this->_goods_list_extend($goods_list);

        output_data(array('goods_list' => $goods_list), mobile_page($page_count));
    }
    
    /**
     * wap商品列表
     */
    public function wapgoods_listOp() {
        $model_goods = Model('goods');
        $model_search = Model('search');
        //$this->page = 0;
        //查询条件
        $condition = array();
        if(!empty($_GET['gc_id']) && intval($_GET['gc_id']) > 0) {
            $condition['gc_id'] = $_GET['gc_id'];
        } elseif (!empty($_GET['keyword'])) {
            $condition['goods_name|goods_jingle'] = array('like', '%' . $_GET['keyword'] . '%');
        }  elseif (!empty($_GET['areaid_1'])) {
            $condition['areaid_1'] = array('eq', $_GET['areaid_1']);
        } elseif (!empty($_GET['areaid_2'])) {
            $condition['areaid_2'] = array('eq', $_GET['areaid_2']);
        }  elseif (!empty($_GET['dist_id'])) {//区域
            $condition['dist_id'] = array('eq', $_GET['dist_id']);
        }elseif (!empty($_GET['goods_commend'])) {
            $condition['goods_commend'] = array('eq', $_GET['goods_commend']);
        } elseif (!empty($_GET['district_id'])) {
            $condition['dist_id'] = array('eq', $_GET['district_id']);
        }
        
        if($_REQUEST['had_type']==2){
            $condition['goods_commend'] = $_REQUEST['had_id'];
        }elseif ($_REQUEST['had_type']==3){
            $condition['is_discount'] = $_REQUEST['had_id'];
        }elseif ($_REQUEST['had_type']==4){
            $condition['goods_flag'] = $_REQUEST['had_id'];
        }elseif ($_REQUEST['had_type']==5){
            $condition['goods_id'] = $_REQUEST['had_id'];
        }elseif ($_REQUEST['had_type']==1){
            $condition['gc_id'] = $_REQUEST['had_id'];
        }elseif($_REQUEST['had_type']==0){
            $condition['store_id'] = 1;
        }
        
        if(!empty($_GET['keyword'])){
            $model_mb_user_token = Model('mb_user_token');
            $key=$_REQUEST['key'];
            $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
            $model_member = Model('member');
            $member_info = $model_member->getMemberInfoByID($mb_user_token_info['member_id']);
            $data['key_word']=$_GET['keyword'];
            $data['key_mobile']=$member_info['member_mobile'];
            $data['key_name']=$member_info['member_name'];
            $data['key_ip']=$_SERVER["REMOTE_ADDR"];
            $data['key_time']=TIMESTAMP;
            $data['client']=$_POST['client'];
            $model_key=Model('key');
            $result=$model_key->saveKey($data);
        }
        
        
        
        //所需字段
        $fieldstr = "goods_id,goods_commonid,store_id,goods_name,goods_price,goods_marketprice,goods_image,goods_salenum,evaluation_good_star,evaluation_count";
        // 添加3个状态字段
        $fieldstr .= ',is_virtual,is_presell,is_fcode,have_gift';
        //排序方式
        $order = $this->_goods_list_order($_GET['orderkey'], $_GET['order']);
        //优先从全文索引库里查找
        list($indexer_ids,$indexer_count) = $model_search->indexerSearch($_GET,$this->page);
        if (is_array($indexer_ids)) {
            //商品主键搜索
            $goods_list = $model_goods->getGoodsOnlineList(array('goods_id'=>array('in',$indexer_ids)), $fieldstr, 0, $order, $this->page, null, false);
            //如果有商品下架等情况，则删除下架商品的搜索索引信息
            if (count($goods_list) != count($indexer_ids)) {
                $model_search->delInvalidGoods($goods_list, $indexer_ids);
            }
            pagecmd('setEachNum',$this->page);
            pagecmd('setTotalNum',$indexer_count);
        } else {
            $goods_list = $model_goods->getGoodsListByColorDistinct($condition, $fieldstr, $order, $this->page);
        }
        $page_count = $model_goods->gettotalpage();
    
        //处理商品列表(抢购、限时折扣、商品图片)
        $goods_list = $this->_goods_list_extend($goods_list);
    
        output_data(array('goods_list' => $goods_list), mobile_page($page_count));
    }

    public function getCommendGoodsOp()
    {
        $model_goods = Model('goods');
        $condition = array("goods_commend"=>'1');
        $field = '*';
        $group = '';
        $order = 'goods_edittime desc';
        $limit = 4;
        $page = 0;
        $lock = false;
        $count = 0;
        $goods_list = $model_goods->getGoodsList($condition, $field , $group,$order, $limit, $page, $lock, $count);
        output_data(array('goods_list' => $goods_list));
    }

    /**
     * 商品列表排序方式
     */
    private function _goods_list_order($key, $order) {
        $result = 'is_own_shop desc,goods_id desc';
        if (!empty($key)) {

            $sequence = 'desc';
            if($order == 1) {
                $sequence = 'asc';
            }

            switch ($key) {
                //销量
                case '1' :
                    $result = 'goods_salenum' . ' ' . 'desc';
                    break;
                //浏览量
                case '2' :
                    $result = 'goods_click' . ' ' . $sequence;
                    break;
                //价格
                case '3' :
                    $result = 'goods_price' . ' ' . $sequence;
                    break;
                case '4' :
                    $result = 'evaluation_good_star' . ' ' . $sequence;
                    break;
                case '5':
                    $result = 'goods_edittime' . ' ' . 'desc';
                    break;
            }
        }
        return $result;
    }

    /**
     * 处理商品列表(抢购、限时折扣、商品图片)
     */
    private function _goods_list_extend($goods_list) {
        //获取商品列表编号数组
        $commonid_array = array();
        $goodsid_array = array();
        foreach($goods_list as $key => $value) {
            $commonid_array[] = $value['goods_commonid'];
            $goodsid_array[] = $value['goods_id'];
        }

        //促销
        $groupbuy_list = Model('groupbuy')->getGroupbuyListByGoodsCommonIDString(implode(',', $commonid_array));
        $xianshi_list = Model('p_xianshi_goods')->getXianshiGoodsListByGoodsString(implode(',', $goodsid_array));
        foreach ($goods_list as $key => $value) {
            //抢购
            if (isset($groupbuy_list[$value['goods_commonid']])) {
                //$goods_list[$key]['goods_price'] = $groupbuy_list[$value['goods_commonid']]['groupbuy_price'];
                $goods_list[$key]['group_flag'] = true;
            } else {
                $goods_list[$key]['group_flag'] = false;
            }

            //限时折扣
            if (isset($xianshi_list[$value['goods_id']]) && !$goods_list[$key]['group_flag']) {
                //$goods_list[$key]['goods_price'] = $xianshi_list[$value['goods_id']]['xianshi_price'];
                $goods_list[$key]['xianshi_flag'] = true;
            } else {
                $goods_list[$key]['xianshi_flag'] = false;
            }

            //商品图片url
            $goods_list[$key]['goods_image_url'] = cthumb($value['goods_image'], 360, $value['store_id']);

            unset($goods_list[$key]['store_id']);
            //unset($goods_list[$key]['goods_commonid']);
            unset($goods_list[$key]['nc_distinct']);
        }

        return $goods_list;
    }

    /**
     * 商品详细页
     */
    public function goods_detailOp() {
        $goods_id = intval($_GET ['goods_id']);
        if(empty($goods_id)) {
            $goods_id = intval($_POST['goods_id']);
        }
        //20161222
        // 商品详细信息
        $model_goods = Model('goods');
        $goods_detail = $model_goods->getGoodsDetail($goods_id);
        if (empty($goods_detail)) {
            output_error('商品不存在');
        }
        //推荐商品
        $model_store = Model('store');
        $hot_sales = $model_store->getHotSalesList($goods_detail['goods_info']['store_id'], 6);
        $goods_commend_list = array();
        foreach($hot_sales as $value) {
            $goods_commend = array();
            $goods_commend['goods_id'] = $value['goods_id'];
            $goods_commend['goods_name'] = $value['goods_name'];
            $goods_commend['goods_price'] = $value['goods_price'];
            $goods_commend['goods_image_url'] = cthumb($value['goods_image'], 240);
            $goods_commend_list[] = $goods_commend;
        }
        
        $goods_detail['goods_commend_list'] = $goods_commend_list;
        //店铺信息
        $store_info = $model_store->getStoreInfoByID($goods_detail['goods_info']['store_id']);
        
        $goods_detail['store_info']['store_id'] = $store_info['store_id'];
        //20161223   ----店铺名称先修改为品牌名,后面还要改回来
        $goods_detail['store_info']['store_name'] = $goods_detail['goods_info']['brand_name'];
        //$goods_detail['store_info']['store_name'] = $store_info['store_name'];
        $goods_detail['store_info']['member_id'] = $store_info['member_id'];
    	//显示QQ及旺旺 多用户商城
    	$goods_detail['store_info']['store_qq'] = $store_info['store_qq'];
    	$goods_detail['store_info']['store_ww'] = $store_info['store_ww'];
    	$goods_detail['store_info']['store_phone'] = $store_info['store_phone'];
        $goods_detail['store_info']['member_name'] = $store_info['member_name'];
        
        $goods_detail['store_info']['avatar'] = getMemberAvatarForID($store_info['member_id']);
        
        if(intval($goods_detail['goods_info']['is_pick']) > 0) {
            $setting = Model("setting")->getListSetting();
            $goods_detail['goods_info']['pick_address'] = $setting['delivery_area_info'].$setting['delivery_address'];
        }
        $goods_detail['goods_info']['share_url'] ="https://www.gxxwkj.com/shop/product.html?id=".$goods_id;
        //商品详细信息处理
        $goods_detail = $this->_goods_detail_extend($goods_detail);
        
        //查找地区，只需要两级，第一级省，第二级市
        $model_area = Model('area');
        $condition['area_deep']=1;
        $condition['area_id']=array('lt', 32);
        $area_province = $model_area->getAreaList($condition, 'area_id,area_name,area_parent_id');
        
        $condition1['area_deep']=2;
        $condition1['area_parent_id']=array('lt', 32);
        $area_city = $model_area->getAreaList($condition1, 'area_id,area_name,area_parent_id');
        
        //保存用户操作商品的行为
        $key=$_REQUEST['key'];
        $model_mb_user_token = Model('mb_user_token');
        $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
        $model_member = Model('member');
        $member_info = $model_member->getMemberInfoByID($mb_user_token_info['member_id']);
        $data['fever_goodsid']=$goods_detail['goods_info']['goods_id'];
        $data['fever_goodsname']=$goods_detail['goods_info']['goods_name'];
        $data['fever_goodsprice']=$goods_detail['goods_info']['goods_price'];
        $data['fever_actid']=$_POST['actid'];
        $data['fever_acttype']=$_POST['acttype'];
        $data['fever_actname']=$_POST['actname'];
        $data['fever_actiontype']=1;
        $data['fever_actiontime']=TIMESTAMP;
        $data['fever_actionip']=$_SERVER["REMOTE_ADDR"];
        $data['client']=$_POST['client'];
 
        $data['fever_actionmobile']=$member_info['member_mobile'];

        $model_fever=Model('fever');
        $result=$model_fever->saveFever($data);
        
        
        output_data($goods_detail,array('area_province'=>$area_province,'area_city'=>$area_city));
    }

    /**
     * 商品详细信息处理
     */
    private function _goods_detail_extend($goods_detail) {
        //整理商品规格
        unset($goods_detail['spec_list']);
        $goods_detail['spec_list'] = $goods_detail['spec_list_mobile'];
        unset($goods_detail['spec_list_mobile']);

        //整理商品图片
        unset($goods_detail['goods_image']);
        $goods_detail['goods_image'] = implode(',', $goods_detail['goods_image_mobile']);
        unset($goods_detail['goods_image_mobile']);

        //商品链接
        $goods_detail['goods_info']['goods_url'] = urlShop('goods', 'index', array('goods_id' => $goods_detail['goods_info']['goods_id']));

        //整理数据
        unset($goods_detail['goods_info']['goods_commonid']);
        unset($goods_detail['goods_info']['gc_id']);
//         unset($goods_detail['goods_info']['gc_name']);
//         unset($goods_detail['goods_info']['store_name']);
        // unset($goods_detail['goods_info']['brand_id']);
        // unset($goods_detail['goods_info']['brand_name']);
        unset($goods_detail['goods_info']['type_id']);
        unset($goods_detail['goods_info']['goods_image']);
        //unset($goods_detail['goods_info']['goods_body']);
        unset($goods_detail['goods_info']['goods_state']);
        unset($goods_detail['goods_info']['goods_stateremark']);
        unset($goods_detail['goods_info']['goods_verify']);
        unset($goods_detail['goods_info']['goods_verifyremark']);
        unset($goods_detail['goods_info']['goods_lock']);
        unset($goods_detail['goods_info']['goods_addtime']);
        unset($goods_detail['goods_info']['goods_edittime']);
        unset($goods_detail['goods_info']['goods_selltime']);
        unset($goods_detail['goods_info']['goods_show']);
        unset($goods_detail['goods_info']['goods_commend']);
        unset($goods_detail['goods_info']['explain']);
        unset($goods_detail['goods_info']['cart']);
        unset($goods_detail['goods_info']['buynow_text']);
        unset($goods_detail['groupbuy_info']);
        unset($goods_detail['xianshi_info']);

        return $goods_detail;
    }
    
    /**
     * 網頁端商品详细页
     */
    public function wapgoods_detailOp() {
        $goods_id = intval($_GET ['goods_id']);
        if(empty($goods_id)) {
            $goods_id = intval($_POST['goods_id']);
        }
        //20161222周家财修改
        // 商品详细信息
        $model_goods = Model('goods');
        $goods_detail = $model_goods->getGoodsDetail($goods_id);
        if (empty($goods_detail)) {
            output_error('商品不存在');
        }
        //推荐商品
        $model_store = Model('store');
        $hot_sales = $model_store->getHotSalesList($goods_detail['goods_info']['store_id'], 6);
        $goods_commend_list = array();
        foreach($hot_sales as $value) {
            $goods_commend = array();
            $goods_commend['goods_id'] = $value['goods_id'];
            $goods_commend['goods_name'] = $value['goods_name'];
            $goods_commend['goods_price'] = $value['goods_price'];
            $goods_commend['goods_image_url'] = cthumb($value['goods_image'], 240);
            $goods_commend_list[] = $goods_commend;
        }
    
        $goods_detail['goods_commend_list'] = $goods_commend_list;
        //店铺信息
        $store_info = $model_store->getStoreInfoByID($goods_detail['goods_info']['store_id']);
    
        $goods_detail['store_info']['store_id'] = $store_info['store_id'];
        //20161223 周家财修改  ----店铺名称先修改为品牌名,后面还要改回来
        $goods_detail['store_info']['store_name'] = $goods_detail['goods_info']['brand_name'];
        //$goods_detail['store_info']['store_name'] = $store_info['store_name'];
        $goods_detail['store_info']['member_id'] = $store_info['member_id'];
        //显示QQ及旺旺 多用户商城
        $goods_detail['store_info']['store_qq'] = $store_info['store_qq'];
        $goods_detail['store_info']['store_ww'] = $store_info['store_ww'];
        $goods_detail['store_info']['store_phone'] = $store_info['store_phone'];
        $goods_detail['store_info']['member_name'] = $store_info['member_name'];
    
        $goods_detail['store_info']['avatar'] = getMemberAvatarForID($store_info['member_id']);
    
        if(intval($goods_detail['goods_info']['is_pick']) > 0) {
            $setting = Model("setting")->getListSetting();
            $goods_detail['goods_info']['pick_address'] = $setting['delivery_area_info'].$setting['delivery_address'];
        }
    
        //商品详细信息处理
        $goods_detail = $this->_goods_detail_extend($goods_detail);
    
        //默认地址
        $key = $_POST['key'];
        if(empty($key)) {
            $key = $_GET['key'];
        }
        $address = null;
        if(!empty($key)) {
            $model_mb_user_token = Model('mb_user_token');
            $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
            if(!empty($mb_user_token_info)) {
                $model_address = Model('address');
                $condition = array();
                $condition['member_id'] = $mb_user_token_info['member_id'];
                $condition['is_default'] = '1';
                $address_info = $model_address->getAddressInfo($condition);
                if($address_info['member_id'] == $this->member_info['member_id']) {
                    $address = $address_info;
                }
            }
        }
        
        $goods_model=Model('goods');
        $goods_list = $goods_model->getGoodsOnlineList(array(), '*', 0, 'goods_id desc', 4, null, false);
        foreach ($goods_list as $key=>$val){
            //切割图片路径
            $img = explode(".", $val['goods_image']);//得到名称和后缀
            $goods_list[$key]['goods_image']=UPLOAD_SITE_URL.'/shop/store/goods/1/'.$val['goods_image'];
        }
        
        //保存用户操作商品的行为
        $key=$_REQUEST['key'];
        $model_mb_user_token = Model('mb_user_token');
        $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
        $model_member = Model('member');
        $member_info = $model_member->getMemberInfoByID($mb_user_token_info['member_id']);
        $data['fever_goodsid']=$goods_detail['goods_info']['goods_id'];
        $data['fever_goodsname']=$goods_detail['goods_info']['goods_name'];
        $data['fever_goodsprice']=$goods_detail['goods_info']['goods_price'];
        $data['fever_actid']=$_POST['actid'];
        $data['fever_acttype']=$_POST['acttype'];
        $data['fever_actname']=$_POST['actname'];
        $data['fever_actiontype']=1;
        $data['fever_actiontime']=TIMESTAMP;
        $data['fever_actionip']=$_SERVER["REMOTE_ADDR"];
        $data['client']=$_POST['client'];
        $data['fever_actionmobile']=$member_info['member_mobile'];

        $model_fever=Model('fever');
        $result=$model_fever->saveFever($data);
        
        
        output_data($goods_detail,array('address_info'=>$address,'goods_list'=>$goods_list,'sign'=>$signPackage));
    }

    /**
     * 商品详细页
     */
    public function goods_bodyOp() {
        $goods_id = intval($_GET ['goods_id']);

        $model_goods = Model('goods');

        $goods_info = $model_goods->getGoodsInfoByID($goods_id, 'goods_commonid');
        $goods_common_info = $model_goods->getGoodeCommonInfoByID($goods_info['goods_commonid']);

        /*$goods_body = array("goods_body"=>unserialize($goods_common_info['mobile_body']));
        output_data($goods_body );*/

        Tpl::output('goods_common_info', $goods_common_info);
        Tpl::showpage('goods_body');
    }
	/**
     * 手机商品详细页
     */
	public function wap_goods_bodyOp() {
        $goods_id = intval($_GET ['goods_id']);

        $model_goods = Model('goods');

        $goods_info =$model_goods->getGoodsInfoByID($goods_id, 'goods_id');
        $goods_common_info =$model_goods->getMobileBodyByCommonID($goods_info['goods_commonid']);
        Tpl:output('goods_common_info',$goods_common_info);
        Tpl::showpage('goods_body');
    }
}
